// 全局变量
:root {
  --primary-color: #667eea;
  --secondary-color: #764ba2;
  --accent-color: #f093fb;
  --text-primary: #2d3748;
  --text-secondary: #718096;
  --text-light: #a0aec0;
  --bg-white: rgba(255, 255, 255, 0.95);
  --bg-card: rgba(255, 255, 255, 0.9);
  --shadow-light: 0 4rpx 20rpx rgba(0, 0, 0, 0.08);
  --shadow-medium: 0 8rpx 30rpx rgba(0, 0, 0, 0.12);
  --shadow-heavy: 0 20rpx 40rpx rgba(0, 0, 0, 0.15);
  --border-radius: 24rpx;
  --border-radius-lg: 32rpx;
}

// 通用图片样式
image {
  max-width: 100%;
  height: auto;
  object-fit: contain;
  display: block;
}

// Taro 编译后的图片组件样式
taro-image-core {
  display: inline-block;
  
  .taro-img__mode-aspectfit {
    max-width: 100%;
    height: auto;
    object-fit: contain;
  }
}

.weather-app {
  height: 100vh;
  max-width: 750rpx;
  margin: 0 auto;
  position: relative;
  overflow-x: hidden;
  overflow-y: auto;
  padding-bottom: 40rpx;
  box-sizing: border-box;
  // 移除原有的渐变背景，使用动态背景组件
}

// 背景装饰
.bg-decoration {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 0;

  .bg-circle {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    animation: float 6s ease-in-out infinite;

    &.circle-1 {
      width: 200rpx;
      height: 200rpx;
      top: 10%;
      right: -50rpx;
      animation-delay: 0s;
    }

    &.circle-2 {
      width: 150rpx;
      height: 150rpx;
      top: 60%;
      left: -30rpx;
      animation-delay: 2s;
    }

    &.circle-3 {
      width: 100rpx;
      height: 100rpx;
      top: 30%;
      left: 50%;
      animation-delay: 4s;
    }
  }
}

@keyframes float {
  0%, 100% { transform: translateY(0rpx) rotate(0deg); }
  50% { transform: translateY(-20rpx) rotate(180deg); }
}

// 头部区域
.header {
  padding: 80rpx 40rpx 40rpx;
  position: relative;
  z-index: 1;

  .header-content {
    text-align: center;

    .app-title {
      display: block;
      font-size: 80rpx;
      font-weight: 700;
      color: #ffffff;
      margin-bottom: 16rpx;
      text-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.1);
      letter-spacing: 2rpx;
    }

    .app-subtitle {
      display: block;
      font-size: 32rpx;
      color: rgba(255, 255, 255, 0.8);
      font-weight: 400;
    }
  }
}

// 搜索区域
.search-container {
  padding: 0 40rpx 40rpx;
  position: relative;
  z-index: 1;

  .search-box {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 50rpx;
    padding: 12rpx 20rpx;
    display: flex;
    align-items: center;
    box-shadow: 0 8rpx 32rpx rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(20rpx);
    border: 2rpx solid rgba(255, 255, 255, 0.3);
    width: 100%;
    box-sizing: border-box;
    transition: all 0.3s ease;

    .search-input-wrapper {
      flex: 1;
      display: flex;
      align-items: center;
      margin-right: 16rpx;
      height: 60rpx;
      position: relative;

      .search-icon {
        width: 32rpx;
        height: 32rpx;
        min-width: 32rpx;
        min-height: 32rpx;
        max-width: 32rpx;
        max-height: 32rpx;
        opacity: 0.7;
        object-fit: contain;
        flex-shrink: 0;
        margin-right: 16rpx;
        z-index: 1;
      }

      .search-input {
        flex: 1;
        height: 60rpx;
        background: transparent !important;
        border: none !important;
        font-size: 32rpx !important;
        padding-left: 0 !important;
      }

      // 输入框文字样式
      input {
        font-size: 32rpx !important;
        color: #333 !important;
        font-weight: 500 !important;
        height: 60rpx !important;
        line-height: 60rpx !important;
        vertical-align: middle !important;
        display: inline-block !important;
      }

      // placeholder 样式
      input::placeholder {
        font-size: 32rpx !important;
        color: #999 !important;
        font-weight: 400 !important;
      }
    }

    .search-button {
      flex-shrink: 0;
      min-width: 160rpx;
      height: 60rpx;
      border-radius: 30rpx;
      background: linear-gradient(135deg, #667eea, #764ba2) !important;
      border: none !important;
      box-shadow: 0 4rpx 16rpx rgba(102, 126, 234, 0.4);
      display: flex !important;
      align-items: center !important;
      justify-content: center !important;
      color: #ffffff !important;
      font-weight: 600 !important;
      font-size: 32rpx !important;
      transition: all 0.3s ease;

      &:hover {
        transform: translateY(-2rpx);
        box-shadow: 0 6rpx 20rpx rgba(102, 126, 234, 0.5);
      }

      &:active {
        transform: translateY(0);
      }
    }
  }
}

// 天气信息容器
.weather-container {
  padding: 0 40rpx;
  position: relative;
  z-index: 1;

  .weather-card {
    transform: translateY(20rpx);
    opacity: 0;
    transition: all 0.6s ease;
    background: var(--bg-card);
    border: 2rpx solid rgba(255, 255, 255, 0.2);
    box-shadow: var(--shadow-heavy);
    backdrop-filter: blur(20rpx);
    border-radius: 24rpx;
    overflow: hidden;

    &.show {
      transform: translateY(0);
      opacity: 1;
    }

    .card-header {
      padding: 30rpx 40rpx 20rpx;
      border-bottom: 1rpx solid rgba(0, 0, 0, 0.05);

      .card-title {
        display: block;
        font-size: 48rpx;
        font-weight: 700;
        color: var(--text-primary);
        margin-bottom: 8rpx;
      }

      .card-subtitle {
        display: block;
        font-size: 28rpx;
        font-weight: 400;
        color: var(--text-secondary);
        opacity: 0.8;
        text-transform: capitalize;
      }
    }

    .card-content {
      padding: 0 40rpx 40rpx;
    }

    .main-weather {
      margin-bottom: 30rpx;

      .weather-temp-section {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-top: 20rpx;
        padding: 0 20rpx;

        .weather-info {
          display: flex;
          align-items: center;
          flex: 1;

          .weather-icon {
            width: 80rpx;
            height: 80rpx;
            min-width: 80rpx;
            min-height: 80rpx;
            max-width: 80rpx;
            max-height: 80rpx;
            margin-right: 20rpx;
            filter: drop-shadow(0 2rpx 4rpx rgba(0, 0, 0, 0.1));
            object-fit: contain;
            flex-shrink: 0;
          }

          .weather-text {
            font-size: 48rpx;
            font-weight: 600;
            color: var(--text-primary);
            text-transform: capitalize;
          }
        }

        .temp-display {
          display: flex;
          align-items: baseline;
          flex-shrink: 0;

          .temp-number {
            font-size: 120rpx;
            font-weight: 300;
            color: var(--text-primary);
            line-height: 1;
          }

          .temp-unit {
            font-size: 48rpx;
            color: var(--text-secondary);
            margin-left: 8rpx;
          }
        }
      }
    }

    .weather-details {
      margin-top: 20rpx;

      .detail-item {
        display: flex;
        align-items: center;
        padding: 24rpx 0;
        border-bottom: 1rpx solid rgba(0, 0, 0, 0.05);

        &:last-child {
          border-bottom: none;
        }

        .detail-icon {
          width: 40rpx;
          height: 40rpx;
          min-width: 40rpx;
          min-height: 40rpx;
          max-width: 40rpx;
          max-height: 40rpx;
          margin-right: 20rpx;
          object-fit: contain;
          flex-shrink: 0;
        }

        .detail-text {
          font-size: 36rpx;
          color: var(--text-primary);
          font-weight: 500;
        }
      }
    }
  }
}

// 错误容器
.error-container {
  padding: 0 40rpx;
  position: relative;
  z-index: 1;

  .error-card {
    background: var(--bg-white);
    border: 2rpx solid rgba(255, 107, 107, 0.3);
    box-shadow: var(--shadow-medium);
    backdrop-filter: blur(20rpx);
    border-radius: 24rpx;
    overflow: hidden;

    .error-content {
      text-align: center;
      padding: 20rpx 0;

      .error-icon {
        width: 48rpx;
        height: 48rpx;
        min-width: 48rpx;
        min-height: 48rpx;
        max-width: 48rpx;
        max-height: 48rpx;
        display: block;
        margin: 0 auto 20rpx;
        object-fit: contain;
      }

      .error-message {
        display: block;
        font-size: 28rpx;
        color: #e53e3e;
        margin-bottom: 30rpx;
        font-weight: 500;
      }
    }
  }
}

// 空状态容器
.empty-container {
  padding: 40rpx 40rpx 60rpx;
  position: relative;
  z-index: 10;
  width: 100%;
  box-sizing: border-box;

  .empty-card {
    background: rgba(255, 255, 255, 0.95);
    border: 2rpx solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 12rpx 40rpx rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(20rpx);
    width: 100%;
    max-width: none;
    min-width: auto;
    border-radius: 32rpx;
    overflow: hidden;

    .empty-content {
      text-align: center;
      padding: 60rpx 40rpx;

      .empty-icon {
        width: 120rpx;
        height: 120rpx;
        min-width: 120rpx;
        min-height: 120rpx;
        max-width: 120rpx;
        max-height: 120rpx;
        display: block;
        margin: 0 auto 40rpx;
        opacity: 0.9;
        filter: drop-shadow(0 4rpx 8rpx rgba(0, 0, 0, 0.1));
        object-fit: contain;
        text-align: center;
        
        // 针对 Taro 编译后的内部图片元素
        .taro-img__mode-aspectfit {
          display: block;
          margin: 0 auto;
          width: 120rpx !important;
          height: 120rpx !important;
          max-width: 120rpx !important;
          max-height: 120rpx !important;
          object-fit: contain !important;
        }
      }

      .empty-title {
        display: block;
        font-size: 48rpx;
        font-weight: 700;
        color: #2d3748;
        margin-bottom: 20rpx;
        letter-spacing: 1rpx;
      }

      .empty-desc {
        font-size: 32rpx;
        color: #718096;
        line-height: 1.6;
        margin-bottom: 50rpx;
        font-weight: 400;
      }

      .empty-suggestions {
        .suggestions-title {
          display: block;
          font-size: 30rpx;
          color: #a0aec0;
          margin-bottom: 30rpx;
          font-weight: 500;
        }

        .suggestion-tags {
          display: flex;
          justify-content: center;
          gap: 20rpx;
          flex-wrap: wrap;

          .suggestion-tag {
            background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
            color: #667eea;
            padding: 18rpx 32rpx;
            border-radius: 30rpx;
            font-size: 28rpx;
            font-weight: 600;
            border: 2rpx solid rgba(102, 126, 234, 0.2);
            transition: all 0.3s ease;
            cursor: pointer;
            box-shadow: 0 2rpx 8rpx rgba(102, 126, 234, 0.1);

            &:hover {
              background: rgba(102, 126, 234, 0.2);
              transform: translateY(-2rpx);
            }

            &:active {
              background: var(--primary-color);
              color: #ffffff;
              transform: translateY(0);
            }
          }
        }
      }
    }
  }
}

// 覆盖 NutUI 默认样式
.nut-input {
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
  height: 60rpx !important;
  display: flex !important;
  align-items: center !important;

  .nut-input__inner {
    background: transparent !important;
    border: none !important;
    font-size: 32rpx !important;
    color: var(--text-primary) !important;
    padding: 0 !important;
    height: 60rpx !important;
    line-height: 60rpx !important;
    vertical-align: middle !important;
    display: inline-block !important;

    &::placeholder {
      color: var(--text-light) !important;
    }

    &:focus {
      background: rgba(255, 255, 255, 0.1) !important;
      border-radius: 16rpx !important;
    }
  }
}

// 针对搜索框的特定样式
.search-input-wrapper .nut-input {
  height: 60rpx !important;
  display: flex !important;
  align-items: center !important;
  
  .nut-input-box {
    height: 60rpx !important;
    display: flex !important;
    align-items: center !important;
  }
  
  input {
    height: 60rpx !important;
    line-height: 60rpx !important;
    vertical-align: middle !important;
    display: inline-block !important;
  }
}

.nut-button {
  border-radius: 20rpx !important;
  font-size: 26rpx !important;
  font-weight: 600 !important;

  &--primary {
    background: linear-gradient(135deg, var(--accent-color), var(--primary-color)) !important;
    border: none !important;
  }
}

.nut-card {
  border-radius: var(--border-radius-lg) !important;
  overflow: hidden !important;

  .nut-card__header {
    padding: 30rpx 40rpx 20rpx !important;

    .nut-card__title {
      font-size: 48rpx !important;
      font-weight: 700 !important;
      color: var(--text-primary) !important;
      margin-bottom: 8rpx !important;
    }

    .nut-card__subtitle {
      font-size: 32rpx !important;
      color: var(--text-secondary) !important;
      text-transform: capitalize !important;
    }
  }

  .nut-card__content {
    padding: 0 40rpx 40rpx !important;
  }
}
